<template>
  <div class="newsinfo">
    <van-card :title="newsinfo.title">
      <div slot="num">
        点击{{newsinfo.click}}次
      </div>
      <div slot="price">
       {{newsinfo.add_time}}
       </div>
    </van-card>
    <div class="content">
        <hr>
        <p>
           {{newsinfo.content}}
        </p>
    </div>
    <Comment :id="id"></Comment>
  </div>
</template>
<script>
import Comment from '../../../../components/Comment'
export default {
  data: () => ({
    id: '',
    newsinfo: {}
  }),
  created () {
    this.id = this.$route.params.id
    this.getNewsInfo()
  },
  methods: {
    async getNewsInfo () {
      const {
        data: { status, message }
      } = await this.$http.get('api/getnew/' + this.id)
      if (status !== 0) return this.$Toast(message)
      //   console.log(message)
      this.newsinfo = message
    }
  },
  components: {
    Comment
  }
}
</script>
<style lang="less" scoped>
.newsinfo {
    padding:0 8px;
    box-sizing: border-box;
    .van-card{
      background-color: #fff;
    }
  .van-card__thumb  {
     height: 55px;
  }
  .van-card__content {
      min-height: 55px;
  }
  .van-card__title {
     margin-bottom: 20px;
     color: red;
     font-size: 16px;
     text-align: center;
  }
  .content p {
    font-size: 12px;
  }
    .van-card__price{
    color: #1989fa;
  }

}
</style>
